# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.http import HttpResponse
from disk.forms import UserForm
from django.shortcuts import render,render_to_response
from .models import User

# Create your views here.
def rigester(request):
    if request.method=='POST':
        uf = UserForm(request.POST,request.FILES)
        if uf.is_valid():
            username = uf.cleaned_data['username']
            headimg = uf.cleaned_data['headimg']
            user = User()
            user.username = username
            user.headimg = headimg
            user.save()
            return HttpResponse('upload ok!')
    else:
        uf = UserForm()
    return render_to_response('register.html',{'uf':uf})
